﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cofe.Core;
using Cofe.Core.Logger;
using Cofe.Core.Script;

namespace Cofe.Web.Feed
{
    [Export(typeof(ICofeService))]
    [ServicePriority(ServicePriorityAttribute.DefaultPriority_COFEWS)]
    public class FeedManager : IFeedManager
    {
        #region Constructor

        public FeedManager()
        {
            
        }
        
        #endregion

        #region Methods


        public List<IFeedService> AllFeedServices
        {
            get { return _allFeedServices ?? (_allFeedServices = CofeServices.ServiceLocater.FindAllServices<IFeedService>().ToList()); }
        }

        public IFeedService<T> GetFeedService<T>() where T : EventArgs
        {
            return AllFeedServices.FirstOrDefault(fs => fs is IFeedService<T>) as IFeedService<T>;
        }

     

        
        #endregion

        #region Data

        List<IFeedService> _allFeedServices = null;
        
        #endregion

        #region Public Properties
        
        public IFeedFileSystemHelper FileSystem { get; private set; }
        
        #endregion



    }
}
